<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>骨骼康复患者数据可视化分析</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        .chart-container {
            height: 350px;
            margin-bottom: 2rem;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <div class="max-w-7xl mx-auto px-4 py-8">
        <!-- 标题区域 -->
        <div class="text-center mb-10">
            <h1 class="text-3xl font-bold text-gray-800 mb-2">不同类型骨骼康复患者数据可视化分析</h1>
            <p class="text-gray-600">基于术后/治疗后不同阶段的核心监测指标对比</p >
        </div>

        <!-- 原始数据表格 -->
        <div class="bg-white rounded-lg shadow-md p-4 mb-8 overflow-x-auto">
            <h2 class="text-xl font-semibold text-gray-700 mb-4">核心监测数据总表</h2>
            <table class="min-w-full divide-y divide-gray-200">
                <thead class="bg-gray-100">
                    <tr>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">患者类型</</th>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">康复阶段</</th>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">关节活动度（ROM）</</th>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">疼痛评分（VAS）</</th>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">肌力等级</</th>
                        <<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">功能恢复情况</</th>
                    </tr>
                </thead>
                <tbody class="bg-white divide-y divide-gray-200">
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">青年股骨骨折（术后）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">4周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">髋关节：屈曲90°、外展30°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">2-3分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">股四头肌：4级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">拄单拐步行200米，可自主起身</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">青年股骨骨折（术后）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">12周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">髋关节：屈曲120°、外展45°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">0-1分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">股四头肌：5级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">弃拐正常步行，可慢跑50米</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">中年膝关节骨关节炎（保守治疗）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">8周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">膝关节：屈曲110°、伸直0°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">3-4分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">腘绳肌：4级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">步行500米无明显不适，可上下3层楼梯</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">中年膝关节骨关节炎（保守治疗）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">16周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">膝关节：屈曲125°、伸直0°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">1-2分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">腘绳肌：4+级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">步行1000米无不适，可缓慢蹲起</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">老年腰椎压缩性骨折（椎体成形术后）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">6周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">腰椎：前屈30°、后伸10°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">2-3分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">竖脊肌：3+级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">佩戴支具坐立1小时，缓慢步行100米</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">老年腰椎压缩性骨折（椎体成形术后）</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">12周</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">腰椎：前屈45°、后伸15°</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">0-1分</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">竖脊肌：4级</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">弃支具坐立2小时，步行300米，可自主穿脱衣物</td>
                    </tr>
                </tbody>
            </table>
        </div>

        <!-- 可视化图表区域 -->
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
            <!-- 疼痛评分（VAS）对比图 -->
            <div class="bg-white rounded-lg shadow-md p-4">
                <h2 class="text-xl font-semibold text-gray-700 mb-4">各患者类型疼痛评分（VAS）变化</h2>
                <div class="chart-container">
                    <canvas id="painChart"></canvas>
                </div>
            </div>

            <!-- 肌力等级对比图 -->
            <div class="bg-white rounded-lg shadow-md p-4">
                <h2 class="text-xl font-semibold text-gray-700 mb-4">各患者类型肌力等级变化</h2>
                <div class="chart-container">
                    <canvas id="muscleChart"></canvas>
                </div>
            </div>

            <!-- 关节活动度对比图（选取核心角度） -->
            <div class="bg-white rounded-lg shadow-md p-4 md:col-span-2">
                <h2 class="text-xl font-semibold text-gray-700 mb-4">各患者类型核心关节活动度（ROM）变化</h2>
                <div class="chart-container">
                    <canvas id="jointChart"></canvas>
                </div>
            </div>
        </div>

        <!-- 数据解读区域 -->
        <div class="bg-white rounded-lg shadow-md p-6">
            <h2 class="text-xl font-semibold text-gray-700 mb-4">数据核心解读</h2>
            <ul class="space-y-2 text-gray-700">
                <li class="flex items-start">
                    <span class="text-blue-500 mr-2">•</span>
                    <span><strong>青年患者恢复速度最快</strong>：青年股骨骨折患者从4周到12周，疼痛评分下降2-3分，肌力从4级提升至正常5级，体现了年轻群体骨骼愈合与肌肉恢复的优势。</span>
                </li>
                <li class="flex items-start">
                    <span class="text-blue-500 mr-2">•</span>
                    <span><strong>中年保守治疗见效平缓</strong>：膝关节骨关节炎患者经8-16周保守治疗，疼痛评分下降2-3分，关节屈曲度提升15°，适合无法手术的慢性骨病患者。</span>
                </li>
                <li class="flex items-start">
                    <span class="text-blue-500 mr-2">•</span>
                    <span><strong>老年患者需重视安全恢复</strong>：老年腰椎骨折患者12周才达到弃支具状态，肌力仅恢复至4级，提示老年群体康复需降低强度、延长周期，避免二次损伤。</span>
                </li>
            </ul>
        </div>
    </div>

    <script>
        // 1. 疼痛评分（VAS）对比图
        const painCtx = document.getElementById('painChart').getContext('2d');
        new Chart(painCtx, {
            type: 'bar',
            data: {
                labels: [
                    '青年股骨骨折（4周）', 
                    '青年股骨骨折（12周）', 
                    '中年膝骨关节炎（8周）', 
                    '中年膝骨关节炎（16周）', 
                    '老年腰椎骨折（6周）', 
                    '老年腰椎骨折（12周）'
                ],
                datasets: [{
                    label: 'VAS疼痛评分（分，越低越好）',
                    data: [2.5, 0.5, 3.5, 1.5, 2.5, 0.5],
                    backgroundColor: [
                        'rgba(255, 159, 64, 0.6)',
                        'rgba(75, 192, 192, 0.6)',
                        'rgba(255, 159, 64, 0.6)',
                        'rgba(75, 192, 192, 0.6)',
                        'rgba(255, 159, 64, 0.6)',
                        'rgba(75, 192, 192, 0.6)'
                    ],
                    borderColor: [
                        'rgba(255, 159, 64, 1)',
                        'rgba(75, 192, 192, 1)',
                        'rgba(255, 159, 64, 1)',
                        'rgba(75, 192, 192, 1)',
                        'rgba(255, 159, 64, 1)',
                        'rgba(75, 192, 192, 1)'
                    ],
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                scales: {
                    y: {
                        beginAtZero: true,
                        max: 10,
                        title: {
                            display: true,
                            text: 'VAS评分（分）'
                        }
                    }
                },
                plugins: {
                    legend: {
                        display: false
                    }
                }
            }
        });

        // 2. 肌力等级对比图
        const muscleCtx = document.getElementById('muscleChart').getContext('2d');
        new Chart(muscleCtx, {
            type: 'line',
            data: {
                labels: [
                    '青年股骨骨折（4周）', 
                    '青年股骨骨折（12周）', 
                    '中年膝骨关节炎（8周）', 
                    '中年膝骨关节炎（16周）', 
                    '老年腰椎骨折（6周）', 
                    '老年腰椎骨折（12周）'
                ],
                datasets: [{
                    label: '肌力等级（级，越高越好）',
                    data: [4, 5, 4, 4.5, 3.5, 4],
                    fill: false,
                    borderColor: 'rgba(153, 102, 255, 1)',
                    tension: 0.1,
                    pointBackgroundColor: 'rgba(153, 102, 255, 1)',
                    pointRadius: 5
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                scales: {
                    y: {
                        beginAtZero: true,
                        max: 5,
                        ticks: {
                            stepSize: 0.5
                        },
                        title: {
                            display: true,
                            text: '肌力等级（0-5级）'
                        }
                    }
                }
            }
        });

        // 3. 关节活动度对比图（核心角度）
        const jointCtx = document.getElementById('jointChart').getContext('2d');
        new Chart(jointCtx, {
            type: 'radar',
            data: {
                labels: [
                    '青年股骨骨折（髋关节屈曲）', 
                    '中年膝骨关节炎（膝关节屈曲）', 
                    '老年腰椎骨折（腰椎前屈）'
                ],
                datasets: [
                    {
                        label: '康复早期（4-8周）',
                        data: [90, 110, 30],
                        backgroundColor: 'rgba(255, 99, 132, 0.2)',
                        borderColor: 'rgba(255, 99, 132, 1)',
                        pointBackgroundColor: 'rgba(255, 99, 132, 1)',
                        pointBorderColor: '#fff',
                        pointHoverBackgroundColor: '#fff',
                        pointHoverBorderColor: 'rgba(255, 99, 132, 1)'
                    },
                    {
                        label: '康复后期（12-16周）',
                        data: [120, 125, 45],
                        backgroundColor: 'rgba(54, 162, 235, 0.2)',
                        borderColor: 'rgba(54, 162, 235, 1)',
                        pointBackgroundColor: 'rgba(54, 162, 235, 1)',
                        pointBorderColor: '#fff',
                        pointHoverBackgroundColor: '#fff',
                        pointHoverBorderColor: 'rgba(54, 162, 235, 1)'
                    }
                ]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
                scales: {
                    r: {
                        angleLines: {
                            display: true
                        },
                        suggestedMin: 0,
                        suggestedMax: 150,
                        title: {
                            display: true,
                            text: '关节活动度（角度°）'
                        }
                    }
                }
            }
        });
    </script>